import logging
from redis import StrictRedis


class Config(object):

    SECRET_KEY = "EjpNVSNQTyGi1VvWECj9TvC/+kq3oujee2kTfQUs8yCM6xX9Yjq52v54g+HVoknA"
    SQLALCHEMY_DATABASE_URI = "mysql://root:djbaka@127.0.0.1:3306/information04"
    SQLALCHEMY_TRACK_MODIFICATIONS = False

    #
    REDIS_HOST = "127.0.0.1"
    REDIS_PORT = 6379
    #session保存配置
    SESSION_TYPE = "redis"
    ##session 签名开启
    SESSION_USE_SIGNER = True
    SESSION_REDIS = StrictRedis(host=REDIS_HOST,port=REDIS_PORT)
    ##session过期时间
    SESSION_PERMANENT = False
    PERMANENT_SESSION_LIFETIME = 86400
    LOG_LEVEL = logging.DEBUG

class Development(Config):
    """开发环境下的配置"""

    DEBUG=True
    LOG_LEVEL = logging.DEBUG

class ProductionConfig(Config):
    # 生产环境下的配置
    DEBUG = False
    # SQLALCHEMY_DATABASE_URI = "xxxx"
    LOG_LEVEL = logging.WARNING

class TestingConfig(Config):
    ##单元测试下的配置

    TESTING = True
    DEBUG = True
    LOG_LEVEL = logging.DEBUG

config ={
    "development":Development,
    "prodution":ProductionConfig,
    "testing":TestingConfig
}